$(document).ready(function () {
    // 模态框控制
    var one = $(".subject-one");
    var two = $(".subject-two");
    var three = $(".subject-three");
    var headerOne = $(".header-one");
    var headerTwo = $(".header-two");
    var headerThree = $(".header-three");
    modalOne(one,two,three,headerOne,headerTwo,headerThree);
    modalTwo(one,two,three,headerOne,headerTwo,headerThree);
    modalThree(one,two,three,headerOne,headerTwo,headerThree);
})
    function modalOne(one,two,three,headerOne,headerTwo,headerThree) {
        $("#edit-btn-one").click(function () {
            $("#edit-btn-one").attr('data-target','#myModalOne');
            one.removeClass('hide');
            two.addClass('hide');
            three.addClass('hide');
            headerOne.removeClass('hide');
            headerTwo.addClass('hide');
            headerThree.addClass('hide');
        })
    }
    function modalTwo(one,two,three,headerOne,headerTwo,headerThree) {
        $("#edit-btn-two").click(function () {
            $("#edit-btn-two").attr('data-target','#myModalOne');
            one.addClass('hide');
            two.removeClass('hide');
            three.addClass('hide');
            headerOne.addClass('hide');
            headerTwo.removeClass('hide');
            headerThree.addClass('hide');
        })
    }
    function modalThree(one,two,three,headerOne,headerTwo,headerThree) {
        $("#edit-btn-three").click(function () {
            $("#edit-btn-three").attr('data-target','#myModalOne')
            one.addClass('hide');
            two.addClass('hide');
            three.removeClass('hide');
            headerOne.addClass('hide');
            headerTwo.addClass('hide');
            headerThree.removeClass('hide');

        })
    }

// 上一页
function lastModal() {
    var one = $(".subject-one");
    var two = $(".subject-two");
    var three = $(".subject-three");
    var headerOne = $(".header-one");
    var headerTwo = $(".header-two");
    var headerThree = $(".header-three");
    if(two.is(":hidden")){
        if(one.is(":hidden")){//3
            three.addClass('hide')
            two.removeClass('hide')
            headerTwo.removeClass('hide')
            headerThree.addClass('hide')
        }else{//1

            alert("已经到第一页了")
        }
    }else{//2
        two.addClass('hide');
        one.removeClass('hide');
        headerOne.removeClass('hide')
        headerTwo.addClass('hide')
    }
}
// 下一页
function nextModal() {
    var one = $(".subject-one");
    var two = $(".subject-two");
    var three = $(".subject-three");
    var headerOne = $(".header-one");
    var headerTwo = $(".header-two");
    var headerThree = $(".header-three");
    if(two.is(":hidden")){
        if(three.is(":hidden")){//2
            one.addClass('hide');
            two.removeClass('hide');
            headerOne.addClass('hide');
            headerTwo.removeClass('hide');
        }else{//3
            alert("已经到最后一页了")
            // infoList.legalData[0].info = $(".second-write-con").val();
            // alert($(".second-write-con").val())
            // alert(infoList.legalData[0].info)
            // window.location = '../../company/view/home.html';
        }
    }else{//1
        headerTwo.addClass('hide');
        headerThree.removeClass('hide');
        two.addClass('hide')
        three.removeClass('hide')
    }
}
